home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / STRINGS / TEXTCASE.PAS < prev   
Pascal/Delphi Source File  |  1996-08-16  |  1KB  |  42 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Demonstration; text case conversion
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBDEF, EFLIBTXT, EFLIBBAS;
  10.  
  11. const Tests = 20000;
  12.  
  13. var TestString : string;
  14.     Timer      : TimerObjectType;
  15.     Index      : word;
  16.  
  17.  
  18. procedure PascalUpperCase (var Data : string);
  19. var Index : byte;
  20. begin
  21.      for Index := 1 to Length(Data) do Data[Index] := UpCase(Data[Index]);
  22. end;
  23.  
  24. begin
  25.  
  26.      Timer.Initialize;
  27.  
  28.      { Generate a test string containing all ASCII characters }
  29.      TestString := '';
  30.      for Index := 1 to 255 do TestString := TestString + Chr(Index);
  31.  
  32.      WriteLn ('Translating ', Tests*255, ' characters to upper case ...');
  33.  
  34.      Write ('  EFLIB upper case routine:    ');
  35.      Timer.Reset; for Index := 1 to Tests do UpperCase(TestString);
  36.      WriteLn (Timer.ElapsedMS:4:0, ' [ms]');
  37.  
  38.      Write ('  Pascal upper case routine:   ');
  39.      Timer.Reset; for Index := 1 to Tests do PascalUpperCase(TestString);
  40.      WriteLn (Timer.ElapsedMS:4:0, ' [ms]');
  41.  
  42. end.